Python 使用 Easyocr 进行图像识别 | 您所在的位置:网站首页 › easyOCR GPU加入 › Python 使用 Easyocr 进行图像识别 |
如果你有NVIDIA GPU,可以额外安装CUDA,提供更好的性能,没有NVIDIA GPU,可以使用CPU计算。 easyocr 官方地址:https://github.com/jaidedai/easyocr 安装 pytorch1pip3 install torch torchvision torchaudio 安装 easyocr1pip3 install easyocr 精简输出默认情况下会输出:Neither CUDA nor MPS are available - defaulting to CPU. Note: This module is much faster with a GPU. 可以通过添加参数 verbose=False 来去掉这个提示。 默认会输出坐标、字符等信息,如果只需要输出字符,可以增加参数 detail=0 获得精简的输出。 1234import easyocrreader = easyocr.Reader(['en'], gpu=False, verbose=False) # 这里加载英文模型,如果需要识别简体中文,可以 reader = easyocr.Reader(['ch_sim', 'en'])result = reader.readtext('D:\\ocr\\1.png',detail=0)print(result[0].replace(" ", ""))第一次运行会下载模型,模型默认存储位置在:%userprofile%\.EasyOCR\model 常见报错fbgemm.dll 加载失败1OSError: [WinError 126] 找不到指定的模块。 Error loading "D:\ocr\venv\Lib\site-packages\torch\lib\fbgemm.dll" or one of its dependencies.在 widnows 环境下,需要安装 Microsoft Visual C++ Redistributable https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist |
CopyRight 2018-2019 实验室设备网 版权所有 |